/*
 *  photoBoothController.h
 *  UseYourHeadApp001
 *
 *  Created by Arne Boon on 5/26/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef PHOTOBOOTH_CONTROLLER
#define PHOTOBOOTH_CONTROLLER

#include "ofMain.h"

#define GRABBED_VID_WIDTH 640
#define GRABBED_VID_HEIGHT 480
#define GRABBED_VID_TOP 350
#define GRABBED_VID_BOTTOM 130
#define DRAW_TOP 100
#define DRAW_BOTTOM 30

class PhotoBoothController : public ofBaseApp{

	public:

		PhotoBoothController();
		~PhotoBoothController();

		void setup();
		void update();
		void draw();

		void mirrorVideo();
		void setHead();
		void setScale(int scale);
		void setMouthSpeeds();
		void moveMouth();

		void keyPressed  (int key);

		bool snapShotTaken;

	private:

		//--video
		unsigned char drawingPixels[GRABBED_VID_WIDTH * GRABBED_VID_HEIGHT * 4];
		unsigned char dataPixels[GRABBED_VID_WIDTH * GRABBED_VID_HEIGHT * 4];
		unsigned char topPixels[GRABBED_VID_WIDTH * GRABBED_VID_HEIGHT * 4];
		ofVideoGrabber videoIn;
		ofTexture top;
		ofTexture bottom;

		ofVideoGrabber vidGrabber;
		ofTexture mirrorTexture;
		unsigned char * videoMirror;
		int camWidth;
		int camHeight;

		int totalPixels;
		int totalPixelsTop;
		int offsetMouth;
		int headX;
		int headY;
		int headTopY;
		int headBottomY;

		ofImage snapShot;
		ofImage topImage;
		ofImage bottomImage;
		ofImage outputImageTop;
		ofImage outputImageBottom;

		bool mouthOpen;
		bool animation;
		unsigned char * snapShotPixels;
		unsigned char * upperPixels;
		unsigned char * lowerPixels;
		float scale;


};

#endif
